package cn.rdq.common.exception;

import org.apache.commons.lang3.StringUtils;

public class BusinessException extends RuntimeException {
  private static final long serialVersionUID = 1L;
  private int errorCode = 1000; // 错误码

  public BusinessException() {

  }

  public BusinessException(String message, Throwable cause) {
    super(message, cause);
  }

  public BusinessException(String message) {
    super(message);
  }

  public BusinessException(String... messages) {
    super(StringUtils.join(messages));
  }

  public BusinessException(Object... messages) {
    super(StringUtils.join(messages));
  }

  public BusinessException(Throwable cause, Object... messages) {
    super(StringUtils.join(messages), cause);
  }

  public BusinessException(Throwable cause) {
    super(cause);
  }

  public BusinessException(int errorCode, String message) {
    super(message);
    this.errorCode = errorCode;
  }

  public BusinessException(int errorCode, String... messages) {
    super(StringUtils.join(messages));
    this.errorCode = errorCode;
  }

  public int getErrorCode() {
    return errorCode;
  }
}
